package com.jiuair.cloud.data.revenue.controller;



//@RestController
public class TestController {

    public static void main(String[] args) {
        String reqSign="0E873305B39BDD5987F48FAB5EC9EFD9";
        String key="70ba3b1fea5948bfa23db46cb59bf4cb";
        String timestamp ="1597805660580";
        String desKey = getDesKey(reqSign, key, timestamp);
        System.out.println(desKey);
    }

    public static  String   getDesKey(String reqSign,String key ,String timestamp){
        StringBuilder desKey = new StringBuilder();
        for (int i =0;i<4;i++){
            char[] ar = timestamp.toCharArray();
            char[] re=  reqSign.toCharArray();
            char[] ke = key.toCharArray();
            char a = ar[ar.length-1-i];
            if (Character.isDigit(a)){  // 判断是否是数字
                int num = Integer.parseInt(String.valueOf(a));
                desKey.append(re[num]);
                desKey.append(ke[num]);
            }

        }
        return desKey.toString();
    }

}
